package com.medvalley.tcm.controller;

import com.medvalley.tcm.base.Result;
import com.medvalley.tcm.service.impl.MusicService;
import com.medvalley.tcm.vo.outputvo.MusicCategoryOutputVo;
import com.medvalley.tcm.vo.outputvo.MusicOutputVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/music_store")
@Api("音乐库")
public class MusicStoreController extends BaseController {

    @Autowired
    private MusicService musicService;

    @GetMapping("/category_list")
    @ApiOperation("音乐分类列表")
    public Result listCategory(@RequestParam int categoryId) {
        List<MusicCategoryOutputVo> outputVoList = musicService.listMusicCategory(categoryId);
        return success(outputVoList);
    }

    @GetMapping("/music_list")
    @ApiOperation("音乐列表")
    public Result listMusic(@RequestParam int categoryId) {
        List<MusicOutputVo> outputVoList = musicService.listMusicByCategory(categoryId);
        return success(outputVoList);
    }

}
